package com.example.mcdonaldapplication.activity

import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.mcdonaldapplication.databinding.ActivityQrcodeBinding
import com.example.mcdonaldapplication.info.UserInfo
import com.tamsiree.rxfeature.tool.RxBarCode
import com.tamsiree.rxfeature.tool.RxQRCode
import com.tamsiree.rxfeature.tool.RxQrBarTool

class QRcodeActivity : AppCompatActivity() {
    private lateinit var binding:ActivityQrcodeBinding
    @SuppressLint("SetTextI18n")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityQrcodeBinding.inflate(layoutInflater)
        setContentView(binding.root)
        supportActionBar?.hide()
        val qrCode = binding.qrCode
        val barCode = binding.barCode
        val prefs = getSharedPreferences("user", MODE_PRIVATE)
        val username = prefs.getString("username", "")
        val balance = prefs.getString("balance", "0.00")
        RxQRCode.createQRCode(username,qrCode)
        RxBarCode.createBarCode(username!!,barCode)
        binding.tvWalletBalance.text = "钱包账户余额: ¥ $balance"
    }
}